﻿//-----------------------------------------------------------------------
// <copyright file="CorporationFactory.cs" company="Mulala">
//     Copyright Mulala. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Mulala.Cavan.Domain.MainBoundedContext.CorporationModule
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Mulala.Cavan.Domain.MainBoundedContext.SecurityModule;
    using Mulala.Cavan.Domain.MainBoundedContext.DictionaryModule;
    using Mulala.Cavan.Domain.MainBoundedContext.NannyModule;
    using Mulala.Cavan.Domain.MainBoundedContext.ConsignModule;
    using Mulala.Cavan.Domain.MainBoundedContext.Setting;

    public static class CorporationFactory
    {
        public static Corporation CreateCorporation(
                                        string fullName, 
                                        UserAccount userAccount, 
                                        Area area, 
                                        DateTime registrationTime,
                                        CorporationIdentifier.CorporationType type, 
                                        int nature, 
                                        int businessExperience, 
                                        int scale, 
                                        long speciality, 
                                        string contact,
                                        string contactEmail, 
                                        string address, 
                                        string telephone, 
                                        string mobile, 
                                        string fax, 
                                        string introduce, 
                                        string culture,
                                        string capital, 
                                        string chargeDescription, 
                                        string homePage, 
                                        string businessLicence, 
                                        string customService,
                                        int satisfactoryTotal, 
                                        int commentTotal, 
                                        int viewTotal, 
                                        int searchTotal, 
                                        bool isDeleted, 
                                        CorporationStatus corporationStatus,
                                        IList<Nanny> nannies, 
                                        IList<ConsignBidder> consignBidders, 
                                        IList<CorporationComment> comments, 
                                        IList<CorporationNew> news, 
                                        DateTime editTime, 
                                        string editUser)
        {
            Corporation corporation = new Corporation();
            corporation.Address = address;
            corporation.Area = area;
            corporation.BusinessExperience = businessExperience;
            corporation.BusinessLicence = businessLicence;
            corporation.Capital = capital;
            corporation.ChargeDescription = chargeDescription;
            corporation.Comments = comments;
            corporation.CommentTotal = commentTotal;
            corporation.ConsignBidders = consignBidders;
            corporation.Contact = contact;
            corporation.ContactEmail = contactEmail;
            if (null != corporationStatus)
            {
                corporation.CorporationStatus = corporationStatus;
                corporationStatus.Corporation = corporation;
            }
            corporation.Culture = culture;
            corporation.CustomService = customService;
            corporation.EditTime = editTime;
            corporation.EditUser = editUser;
            corporation.Fax = fax;
            corporation.FullName = fullName;
            corporation.HomePage = homePage;
            corporation.Introduce = introduce;
            corporation.IsDeleted = isDeleted;
            corporation.Mobile = mobile;
            corporation.Nannies = nannies;
            corporation.Nature = nature;
            corporation.News = news;
            corporation.RegistrationTime = registrationTime;
            corporation.SatisfactoryTotal = satisfactoryTotal;
            corporation.Scale = scale;
            corporation.SearchTotal = searchTotal;
            corporation.Speciality = speciality;
            corporation.Telephone = telephone;
            corporation.Type = type;
            corporation.UserAccount = userAccount;
            corporation.ViewTotal = viewTotal;
            corporation.CreateTime = DateTime.Now;

            return corporation;
        }

        public static Corporation CreateCorporation(UserAccount userAccount, Area area, CorporationStatus corporationStatus)
        {
            Corporation corporation = CorporationFactory.CreateCorporation(Project.Settings.DefaultInfo, userAccount, area, DateTime.Parse(Project.Settings.DefaultTime), CorporationIdentifier.CorporationType.Both, 0, 0,
                                                            0, 0, Project.Settings.DefaultInfo, Project.Settings.DefaultInfo, Project.Settings.DefaultInfo, Project.Settings.DefaultInfo,
                                                            Project.Settings.DefaultInfo, Project.Settings.DefaultInfo, Project.Settings.DefaultInfo, Project.Settings.DefaultInfo,
                                                            Project.Settings.DefaultInfo, Project.Settings.DefaultInfo, Project.Settings.DefaultInfo, Project.Settings.DefaultInfo,
                                                            Project.Settings.DefaultInfo, 0, 0, 0, 0, false, corporationStatus, null, null, null, null, DateTime.Now, userAccount.Name);
            return corporation;
        }

        public static Corporation CreateCorporation(int id)
        {
            Corporation corporation = new Corporation();
            corporation.ID = id;

            return corporation;
        }
    }
}
